/**
 */
package usixmlcui.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import usixmlcui.AlignmentType;
import usixmlcui.Color;
import usixmlcui.ConcreteGraphicalStyle;
import usixmlcui.ConcreteStyle;
import usixmlcui.Usixml_cuiPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Concrete Graphical Style</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link usixmlcui.impl.ConcreteGraphicalStyleImpl#getEReference0 <em>EReference0</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteGraphicalStyleImpl#getBackgroundImage <em>Background Image</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteGraphicalStyleImpl#getBorderWidth <em>Border Width</em>}</li>
 *   <li>{@link usixmlcui.impl.ConcreteGraphicalStyleImpl#getTextAlignment <em>Text Alignment</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ConcreteGraphicalStyleImpl extends ConcreteStyleImpl implements ConcreteGraphicalStyle {
	/**
	 * The cached value of the '{@link #getEReference0() <em>EReference0</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEReference0()
	 * @generated
	 * @ordered
	 */
	protected Color eReference0;

	/**
	 * The default value of the '{@link #getBackgroundImage() <em>Background Image</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBackgroundImage()
	 * @generated
	 * @ordered
	 */
	protected static final String BACKGROUND_IMAGE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getBackgroundImage() <em>Background Image</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBackgroundImage()
	 * @generated
	 * @ordered
	 */
	protected String backgroundImage = BACKGROUND_IMAGE_EDEFAULT;

	/**
	 * The default value of the '{@link #getBorderWidth() <em>Border Width</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBorderWidth()
	 * @generated
	 * @ordered
	 */
	protected static final float BORDER_WIDTH_EDEFAULT = 0.0F;

	/**
	 * The cached value of the '{@link #getBorderWidth() <em>Border Width</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBorderWidth()
	 * @generated
	 * @ordered
	 */
	protected float borderWidth = BORDER_WIDTH_EDEFAULT;

	/**
	 * The default value of the '{@link #getTextAlignment() <em>Text Alignment</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTextAlignment()
	 * @generated
	 * @ordered
	 */
	protected static final AlignmentType TEXT_ALIGNMENT_EDEFAULT = AlignmentType.TOP_LEFT_LITERAL;

	/**
	 * The cached value of the '{@link #getTextAlignment() <em>Text Alignment</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTextAlignment()
	 * @generated
	 * @ordered
	 */
	protected AlignmentType textAlignment = TEXT_ALIGNMENT_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ConcreteGraphicalStyleImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return Usixml_cuiPackage.Literals.CONCRETE_GRAPHICAL_STYLE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Color getEReference0() {
		if (eReference0 != null && eReference0.eIsProxy()) {
			InternalEObject oldEReference0 = (InternalEObject)eReference0;
			eReference0 = (Color)eResolveProxy(oldEReference0);
			if (eReference0 != oldEReference0) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__EREFERENCE0, oldEReference0, eReference0));
			}
		}
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Color basicGetEReference0() {
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEReference0(Color newEReference0) {
		Color oldEReference0 = eReference0;
		eReference0 = newEReference0;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__EREFERENCE0, oldEReference0, eReference0));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getBackgroundImage() {
		return backgroundImage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBackgroundImage(String newBackgroundImage) {
		String oldBackgroundImage = backgroundImage;
		backgroundImage = newBackgroundImage;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__BACKGROUND_IMAGE, oldBackgroundImage, backgroundImage));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public float getBorderWidth() {
		return borderWidth;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBorderWidth(float newBorderWidth) {
		float oldBorderWidth = borderWidth;
		borderWidth = newBorderWidth;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__BORDER_WIDTH, oldBorderWidth, borderWidth));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AlignmentType getTextAlignment() {
		return textAlignment;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTextAlignment(AlignmentType newTextAlignment) {
		AlignmentType oldTextAlignment = textAlignment;
		textAlignment = newTextAlignment == null ? TEXT_ALIGNMENT_EDEFAULT : newTextAlignment;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__TEXT_ALIGNMENT, oldTextAlignment, textAlignment));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__EREFERENCE0:
				if (resolve) return getEReference0();
				return basicGetEReference0();
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__BACKGROUND_IMAGE:
				return getBackgroundImage();
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__BORDER_WIDTH:
				return new Float(getBorderWidth());
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__TEXT_ALIGNMENT:
				return getTextAlignment();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__EREFERENCE0:
				setEReference0((Color)newValue);
				return;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__BACKGROUND_IMAGE:
				setBackgroundImage((String)newValue);
				return;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__BORDER_WIDTH:
				setBorderWidth(((Float)newValue).floatValue());
				return;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__TEXT_ALIGNMENT:
				setTextAlignment((AlignmentType)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__EREFERENCE0:
				setEReference0((Color)null);
				return;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__BACKGROUND_IMAGE:
				setBackgroundImage(BACKGROUND_IMAGE_EDEFAULT);
				return;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__BORDER_WIDTH:
				setBorderWidth(BORDER_WIDTH_EDEFAULT);
				return;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__TEXT_ALIGNMENT:
				setTextAlignment(TEXT_ALIGNMENT_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__EREFERENCE0:
				return eReference0 != null;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__BACKGROUND_IMAGE:
				return BACKGROUND_IMAGE_EDEFAULT == null ? backgroundImage != null : !BACKGROUND_IMAGE_EDEFAULT.equals(backgroundImage);
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__BORDER_WIDTH:
				return borderWidth != BORDER_WIDTH_EDEFAULT;
			case Usixml_cuiPackage.CONCRETE_GRAPHICAL_STYLE__TEXT_ALIGNMENT:
				return textAlignment != TEXT_ALIGNMENT_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (backgroundImage: ");
		result.append(backgroundImage);
		result.append(", borderWidth: ");
		result.append(borderWidth);
		result.append(", textAlignment: ");
		result.append(textAlignment);
		result.append(')');
		return result.toString();
	}

} //ConcreteGraphicalStyleImpl
